
package com.rx.mgt.remove;  

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/** 
 * ClassName:UserGroupService 
 * Function :
 * Reason   : 
 * Date     :Feb 4, 2017 1:49:48 PM 
 * @author   luolei 
 * @since    JDK 1.6
 */
@Service
public class UserGroupService {
    @Autowired
    UserGroupDao userGroupDao;

    public  List list(){
        return userGroupDao.list();
    }
    public UserGroup get(Long id){
        return userGroupDao.get(id);
    }
    public void  delete(Long id){
        userGroupDao.delete(userGroupDao.get(id));
    }
    
    public void saveOrUpdate(UserGroup userGroup){
        if(userGroup.getId()!=null&&userGroup.getId()>0){
            UserGroup group = userGroupDao.get(userGroup.getId());
            if(group!=null){
                userGroupDao.update(userGroup);
            } else{
                userGroupDao.save(userGroup);
            }
        }else{
            userGroupDao.save(userGroup);
        }
    }
}
  